package com.framework.spring.bpp.bfpp;

import com.framework.spring.bpp.bean.BeanPostProcessorService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Slf4j(topic = "e")
@Component
public class ABeanFactoryPostProcessor implements BeanFactoryPostProcessor, InitializingBean {
//public class ABeanFactoryPostProcessor implements BeanPostProcessor, InitializingBean {

	@Autowired
	private BeanPostProcessorService beanPostProcessorService;

	@PostConstruct
	public void postConstruct() {
		log.info("ABeanFactoryPostProcessor.postConstruct--{}", beanPostProcessorService);
	}

	@Override
	public void afterPropertiesSet() throws Exception {
		log.info("ABeanFactoryPostProcessor.afterPropertiesSet--{}", beanPostProcessorService);
	}

	@Override
	public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
		log.info("ABeanFactoryPostProcessor.postProcessBeanFactory--{}", beanPostProcessorService);
	}
}
